﻿#Include ..\baseHandle.ahk

class Open_url extends BaseHandle {

  static Handle(parsed) {
    cfs := MeowConf.Of('./cfg/misc/openDev.txt')
    remote := parsed.target, p := parsed.extra[1]
    if !(r := cfs.Get('remote').Get(remote))
      return this.Fail(r ' undeclare')
    if !(k := cfs.Get(p))
      return this.Fail(k ' undeclare')
    Run (u := Format('http://{}:{}', r, k))
    return this.Succ(u, 'x')
  }

  static Conf() {
    cfs := MeowConf.Of('./cfg/misc/openDev.txt')
    remote := cfs.Get('remote')
    keys := cfs.data.keys.filter(v => v != 'remote')
    return ToString(remote) '`n' keys.Join(',')

  }

  static Echo() => '
  (
    ou
    ou <type> <name>
    type 主机类型
    name 应用名
  )'

}
